class WrongNumberOfPlayersError < StandardError ; end
class NoSuchStrategyError < StandardError ; end
def strategy_check(game)
	game.each{|x| s = x[1].downcase
	raise NoSuchStrategyError unless (s == 'r') or (s == 's')  or (s == 'p')}
	true
end
def winner(a, b)
	q = a[1].downcase
	w = b[1].downcase
	if q == w
		a
	elsif (q == 'r' and w =='s') or (q == 'p' and w == 'r') or (q == 's' and w == 'p')
		a
	else
		b
	end
end
def rps_game_winner(game)
	raise WrongNumberOfPlayersError unless game.length == 2
	strategy_check(game)
	winner(game[0], game[1])
end
def rps_tournament_winner(game)
	if game[0][0].is_a?(String)
		winner(game[0], game[1])
	else
		winner(rps_tournament_winner(game[0]), rps_tournament_winner(game[1]))
	end
end
